<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数据监控面板</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <div class="container">
        <header class="header">
            <h1>我的监控列表</h1>
            <div class="indices-container">
                <div class="index-item">
                    <span class="index-label">上证指数</span>
                    <div class="index-info">
                        <span id="shIndexValue" class="index-value">--</span>
                        <span id="shIndexChange" class="index-change">--</span>
                    </div>
                </div>
                <div class="index-item">
                    <span class="index-label">创业板指</span>
                    <div class="index-info">
                        <span id="cyIndexValue" class="index-value">--</span>
                        <span id="cyIndexChange" class="index-change">--</span>
                    </div>
                </div>
              </div>
            <div class="stats-container">
                <div class="stat-item">
                    <span class="stat-label">整体变化</span>
                    <span id="totalChange" class="stat-value">0.00%</span>
                </div>
                <div class="stat-item">
                    <span class="stat-label">数据时间</span>
                    <span id="updateTime" class="stat-value">--:--:--</span>
                </div>
            </div>
        </header>

        <main class="main-content">
            <div class="add-item-container">
                <div class="input-group">
                    <input type="text" id="itemInput" placeholder="输入代码或名称（如：000001 或 平安银行）">
                    <button id="addItemBtn">添加标的</button>
                </div>
                <div id="errorMessage" class="error-message"></div>
            </div>

            <div class="items-container">
                <div id="itemsList" class="items-list">
                    <!-- 监控项目列表将动态生成 -->
                </div>
                <div id="emptyState" class="empty-state">
                    <p>暂无监控项目</p>
                    <p>输入代码或名称添加监控项目</p>
                </div>
            </div>
        </main>

        <!-- K线图悬浮容器 -->
        <div id="klineContainer" class="kline-container">
            <div class="kline-header">
                <h4 id="klineTitle" class="kline-title">--</h4>
                <button class="kline-close" onclick="portfolio.hideKLine()">&times;</button>
            </div>
            <div class="kline-chart">
                <canvas id="klineCanvas" width="300" height="200"></canvas>
            </div>
            <div class="kline-loading" id="klineLoading">
                <span class="loading"></span>加载中...
            </div>
            <div class="kline-error" id="klineError" style="display: none;">
                加载失败，请重试
            </div>
        </div>

      </div>

    <script src="script.js"></script>
</body>
</html>